<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String imgPath=request.getSession().getServletContext().getRealPath("upload")+"/timg.jpg";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>文件上传下载</title>  
</head>  
<body>  
    <form action="<%=basePath %>file/upload" method="post" enctype="multipart/form-data">  
        选择文件:<input type="file" name="file" width="120px">  
        <input type="submit" value="上传吧">  
    </form>  
    <hr>  
    <form action="<%=basePath %>file/down" method="get">  
    	输入要下载的文件名(例：timg.jpg)<input  name="fileTrueName"/>
        <input type="submit" value="下载">  
    </form>  
    <img alt="" src="<%=basePath %>upload/img/timg.jpg">
    <%=basePath %>
</body>  
</html>  